<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>双向绑定</title>
  </head>
  <body>
    <div id="app">
      <!-- 双向绑定必定是和表单元素相关的 -->
      <!-- v-model指令可以用于双向绑定，input的内容和data里面的响应式数据 -->
      <!-- v-model只是一个语法糖 -->
      <input type="text" v-model="msg" />
      <p>{{ msg }}</p>
      <button v-on:click="handleClick">btn</button>
    </div>

    <script src="../../Vue.js"></script>
    <script>
      const vm = new Vue({
        el: "#app",
        data: {
          msg: "hello Vue",
        },
        methods: {
          handleClick() {
            this.msg = "hi";
          },
        },
      });
    </script>
  </body>
</html>
